package com.ycx.ycxmybatismanagement.mapper;

import com.github.pagehelper.Page;
import com.ycx.ycxmybatismanagement.dto.StudentDTO;
import com.ycx.ycxmybatismanagement.dto.StudentListDTO;
import com.ycx.ycxmybatismanagement.pojo.Student;
import com.ycx.ycxmybatismanagement.vo.StudentListVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    Page<StudentListVO> studentPageList(StudentListDTO studentListDTO);

    void deleteStudentListById(@Param("array") Integer[] ids);

    void addStudent(Student student);
    @Select("select * from student where id =#{id}")
    StudentListVO selectStudentById(Integer id);

    void updateStudentById(Student student);

    void updateStudentScore(Student studentCAndS);
//    @Results({
//            @Result(id = true, column = "id", property = "id"),
//            @Result(id = true, column = "violation_count", property = "violationCount"),
//            @Result(id = true, column = "violation_score", property = "violationScore"),
//    })
//    @Select("select violation_count,violation_score from student where id =#{id}")
//    List<Integer> selectStudentCountAndScoreById(Integer id);
    @Select("select violation_count  from student where id =#{id}")
    Integer selectStudentCountById(Integer id);
    @Select("select violation_score  from student where id =#{id}")
    Integer selectStudentScoreById(Integer id);
}
